<template>
	<div class="main_margin">
		<div class="">
			<a-row type="flex">
			<!-- 左侧区 -->
			<a-col :flex="1">
				<a-row style="line-height:20px;">
					<a-button type="link" @click="addDataType()">
						<a-icon type="file-add" />新增</a-button>
					<a-button type="link" @click="copyDataType()">
						<a-icon type="snippets" />套用</a-button>
				</a-row>
				<a-row>
					<a-row type="flex">
						<a-col :flex="1">
							<div style="height:600px;overflow: hidden;overflow-y: scroll;border-style: solid;border-color: #00B7B8;border-width: 1px;" >
								<!-- <div v-for="(item,index) in typeList" style="line-height: 10px;" :index="index" :RUID="item.RUID" :tablename="item.tablename">
									<a-button class="button-color-sunset" block ref="{{'button_'+item.index}}" v-on:click="refreshDataTypeInfo(item.RUID)">
										{{item.name}}
									</a-button>
								</div> -->
								  <div>
								    <a-menu :default-selected-keys="[0]"  mode="vertical"  >
								      <a-menu-item v-for="(item,index) in typeList" :key="index" :RUID="item.RUID" @click="handleMenuClick(item.RUID)"  @select="handleMenuClick(item.RUID)">
								        {{item.name}}
								      </a-menu-item>    
								    </a-menu>
								  </div>
								
							</div>
						</a-col>

					</a-row>
				</a-row>

			</a-col>
			<!-- 右侧按区 -->
			<a-col :flex="5">
				<a-row>
					<a-form-model :model="form" :label-col="{ span: 7 }" :wrapper-col="{ span: 16 }">
						<a-row style="margin-bottom:1px;" type="flex" justify="space-around" align="middle">
							<a-col :span="4">
								<!-- 占位 -->
							</a-col>
							<a-col :span="8">
								<a-form-model-item :wrapper-col="{ span: 14, offset: 12 }" :model="form">
									<a-button type="primary" style="margin-right: 10px;" @click="onSubmit()">
										保存
									</a-button>
									<a-button type="primary" style="margin-right: 10px;" @click="onDataSet()">
										资料组
									</a-button>
									<a-button style="margin-right: 10px;">
										删除
									</a-button>
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item :wrapper-col="{ span: 14, offset: -1 }">
									<a-button type="link" @click="onInitDataStructure()">
										<a-icon type="file-add" />
										初始化数据结构
									</a-button>
									<a-button type="link" style="margin-left: 1px;" @click="onDataBackup()">
										<a-icon type="file-add" />
										数据备份
									</a-button>
									<a-button type="link" style="margin-left: 1px;" @click="onRecovery()">
										<a-icon type="file-add" />
										数据恢复
									</a-button>
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="编码:">
									<a-input v-model="form.code" />
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item :label-col="{ span: 3 }" label="名称:">
									<a-input v-model="form.name" id="aaa" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="表名:">
									<a-input v-model="form.tablename" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="无权下载:">
									<a-input v-model="form.nodownrightmessage" />
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item label="无权阅读:" :label-col="{ span: 3 }">
									<a-input v-model="form.noreadrightmessage" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="录入页面:">
									<a-input v-model="form.editorpage" />
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item :wrapper-col="{ span: 14, offset: -1 }">
									<a-button style="margin-right: 10px;" @click="onPageSelect('editorpage',form.editorpage)">选择</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCopy('editorpage',form.editorpage)">套用</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCreat('editorpage',form.editorpage)">新建</a-button>
									<a-button style="margin-right: 10px;" @click="onPageAdd('editorpage',form.editorpage)">增量</a-button>
									<a-button style="margin-right: 10px;" @click="onPageSet('editorpage',form.editorpage)">设置</a-button>
								</a-form-model-item>

							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="详情页面:">
									<a-input v-model="form.detailspage" />
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item :wrapper-col="{ span: 14, offset: -1 }">
									<a-button style="margin-right: 10px;" @click="onPageSelect('detailspage',form.detailspage)">选择</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCopy('detailspage',form.detailspage)">套用</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCreat('detailspage',form.detailspage)">新建</a-button>
									<a-button style="margin-right: 10px;" @click="onPageAdd('detailspage',form.detailspage)">增量</a-button>
									<a-button style="margin-right: 10px;" @click="onPageSet('detailspage',form.detailspage)">设置</a-button>
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="移动端详情页面:">
									<a-input v-model="form.phonedetailspage" />
								</a-form-model-item>
							</a-col>
							<a-col :span="12">
								<a-form-model-item :wrapper-col="{ span: 14, offset: -1 }">
									<a-button style="margin-right: 10px;" @click="onPageSelect('phonedetailspage',form.phonedetailspage)">选择</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCopy('phonedetailspage',form.phonedetailspage)">套用</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCreat('phonedetailspage',form.phonedetailspage)">新建</a-button>
									<a-button style="margin-right: 10px;" @click="onPageAdd('phonedetailspage',form.phonedetailspage)">增量</a-button>
									<a-button style="margin-right: 10px;" @click="onPageSet('phonedetailspage',form.phonedetailspage)">设置</a-button>
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="16">
							</a-col>
							<a-col :span="8">
								<a-form-model-item :wrapper-col="{ span: 14, offset: -1 }">
									<a-button style="margin-right: 10px;" @click="onPageSelect('phonedetailspage',form.phonedetailspage)">套用元数据</a-button>
									<a-button style="margin-right: 10px;" @click="onPageCopy('phonedetailspage',form.phonedetailspage)">追加元数据</a-button>
								</a-form-model-item>
							</a-col>
						</a-row>
						<!-- <a-row>
							<a-col :span="12">
								<a-form-model-item label="元数据列表:">
									<div style="width: 1000px;margin-left: 10px;margin-bottom: 20px;">
										<a-table :columns="columns" :data-source="tableData" :pagination="false" :scroll="{ y: 300 }" rowKey='RUID'>
											<span slot="operation" slot-scope="text, record">
												<a slot="action" href="javascript:;" @click="onTableSet(record,text)">设置</a>
												<a-divider type="vertical" />
												<a slot="action" href="javascript:;" @click="onTableDelete(record)">删除</a>
												<a-divider type="vertical" />
												<a slot="action" href="javascript:;" @click="onTableInsert(record)">插入</a>
												<a-divider type="vertical" />
												<a slot="action" href="javascript:;" @click="onTableMoveUp(record)">上移</a>
												<a-divider type="vertical" />
											</span>

										</a-table>
									</div>
								</a-form-model-item>
							</a-col>
						</a-row> -->

						<a-row>
							<a-col :span="12">
								<a-form-model-item label="元数据列表:">
									<div style="width: 1000px;margin-left: 10px;margin-bottom: 20px;">
										<a-button class="editable-add-btn" @click="handleAdd">
											添加元数据
										</a-button>
										<a-table bordered :data-source="tableData" :pagination="false" :scroll="{ y: 300 }" :columns="columns"
										 :rowKey='record=>record.RUID'>
											<template v-for="col in ['name', 'code', 'valuetype']" :slot="col" slot-scope="text, record">
												<div :key="col">
													<a-input v-if="record.editable" style="margin: -5px 0" :value="text" @change="e => handleChange_1(e.target.value, record.key, col)" />
													<template v-else>
														{{ text }}
													</template>
												</div>
											</template>
											<template slot="operation" slot-scope="text, record">
												<a-popconfirm v-if="tableData.length" title="确认删除?" @confirm="() => onDelete(record.RUID)">
													<a href="javascript:;">删除</a>
												</a-popconfirm>
												<a-divider type="vertical" />
												<a href="javascript:;" @click="onTableSet(record)">设置</a>
												<a-divider type="vertical" />
												<a href="javascript:;">插入</a>
												<a-divider type="vertical" />
												<a href="javascript:;" @click="onTableMoveUp(record)">上移</a>
												<div class="editable-row-operations">
													<span v-if="record.editable">
														<a @click="() => save_1(record.key)">保存</a>
														<a-popconfirm title="Sure to cancel?" @confirm="() => cancel_1(record.key)">
															<a>取消</a>
														</a-popconfirm>
													</span>
													<span v-else>
														<a :disabled="editingKey !== ''" @click="() => edit_1(record.key)">编辑</a>
													</span>
												</div>
											</template>

										</a-table>
									</div>
								</a-form-model-item>
							</a-col>
						</a-row>

						<a-row>
							<a-col :span="12">
								<a-form-model-item label="列表页面显示模板:">
									<a-textarea v-model="form.listhtml" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="详细页面显示模板:">
									<a-textarea v-model="form.listhtml" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="移动端列表页面显示模板:">
									<a-textarea v-model="form.listhtml" />
								</a-form-model-item>
							</a-col>
						</a-row>
						<a-row>
							<a-col :span="12">
								<a-form-model-item label="移动端详细页面显示模板:">
									<a-textarea v-model="form.listhtml" />
								</a-form-model-item>
							</a-col>
						</a-row>
					</a-form-model>
				</a-row>

			</a-col>
		</a-row>
		<div>
			<a-modal v-model="dataTypeVisible" title="新增" @ok="handleOk('dataTypeForm')" @cancel="resetForm('dataTypeForm')"
			 destroyOnClose:true>
				<a-form-model ref="dataTypeForm" :model="dataTypeForm" :label-col="{ span: 7}" :wrapper-col="{ span: 14 }">
					<a-form-model-item label="资料类型名称:" prop="dataTypeName">
						<a-input v-model="dataTypeForm.dataTypeName" />
					</a-form-model-item>
					<a-form-model-item label="资料类型编码:" prop="dataTypeCode">
						<a-input v-model="dataTypeForm.dataTypeCode " />
					</a-form-model-item>
					<a-form-model-item label="表名:" prop="dataTypeTable">
						<a-input v-model="dataTypeForm.dataTypeTable" />
					</a-form-model-item>
					<!--<a-form-model-item :wrapper-col="{ span: 4, offset: 4 }">
						<a-button style="margin-left: 10px" @click="resetForm('dataTypeForm')">
							Reset
						</a-button>
					</a-form-model-item> -->
				</a-form-model>
			</a-modal>
		</div>

		<div>
			<a-modal width='800px' v-model="tableDataVisible" :title="editMetaTitle" @ok="handleTableOk('tableDataForm')" @cancel="resetForm('tableDataForm')"
			 destroyOnClose:true>
				<div style="height:600px;overflow: hidden;overflow-y: scroll;">
					<a-form-model ref="tableDataForm" :model="tableDataForm" :label-col="{ span: 7}" :wrapper-col="{ span: 14 }">
						<a-form-model-item label="元数据编码:">
							<a-input v-model="tableDataForm.code" />
						</a-form-model-item>
						<a-form-model-item label="元数据名称:">
							<a-input v-model="tableDataForm.name" />
						</a-form-model-item>
						<a-form-model-item label="元数据字段:">
							<a-input v-model="tableDataForm.fieldname" />
						</a-form-model-item>
						<a-form-model-item label="元数据权限:">
							<a-select placeholder="全部">
								<a-select-option value="1">
									在线阅读权限
								</a-select-option>
								<a-select-option value="2">
									下载权限
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="实体类型:" v-if="getElementShow(tableDataForm.valuetype,'N')">
							<a-select v-model="tableDataForm.entitytype" placeholder="全部" @change="handleEntityTypeChange">
								<a-select-option v-for="item in entitytypeList"  :value="item.name" :key="item.RUID" @click='handleEntityTypeClick(item)' >
									{{item.name}}
								</a-select-option>
								
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="实体保存字段:" v-if="getElementShow(tableDataForm.valuetype,'N')">
							<a-select v-model="tableDataForm.feildname" placeholder="全部" @change="handleEntityTypeChange">
								<a-select-option v-for="item in feildnameList"  :value="item.name" :key="item.RUID" >
									{{item.name}}
								</a-select-option>
								
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="显示实体字段:" v-if="getElementShow(tableDataForm.valuetype,'N')">
							<a-select v-model="tableDataForm.feildname" placeholder="全部" @change="handleEntityTypeChange">
								<a-select-option v-for="item in feildnameList"  :value="item.name" :key="item.RUID" >
									{{item.name}}
								</a-select-option>
								
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="显示格式:" v-if="getElementShow(tableDataForm.valuetype,'D')">
							<a-select v-model="tableDataForm.pattern"  :default-value="tableDataForm.pattern">
								<a-select-option value="yyyy">
									年(yyyy)
								</a-select-option>
								<a-select-option value="yyyy-MM">
									年-月(yyyy-MM)
								</a-select-option>
								<a-select-option value="yyyy-MM-dd">
									年-月-日(yyyy-MM-dd)
								</a-select-option>
								<a-select-option value="yyyy-MM-dd HH:mm:ss">
									年-月-日 时:分:秒(yyyy-MM-dd HH:mm:ss)
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="开始时间:" v-if="getElementShow(tableDataForm.valuetype,'D')">
							<el-date-picker
							      v-model="tableDataForm.fromtime"
								  :default-time="tableDataForm.fromtime"
							      type="year"
								  v-if="tableDataForm.pattern=='yyyy'"
								  value-format="yyyy"
							      placeholder="选择年">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.fromtime"
							      :default-time="tableDataForm.fromtime"
							      type="month"
								  v-if="tableDataForm.pattern=='yyyy-MM'"
								  value-format="yyyy-MM"
							      placeholder="选择月">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.fromtime"
							      :default-time="tableDataForm.fromtime"
							      type="date"
								  v-if="tableDataForm.pattern=='yyyy-MM-dd'"
								  value-format="yyyy-MM-dd"
							      placeholder="选择日期">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.fromtime"
							      :default-time="tableDataForm.fromtime"
							      type="datetime"
								  v-if="tableDataForm.pattern=='yyyy-MM-dd HH:mm:ss'"
								  value-format="yyyy-MM-dd HH:mm:ss"
							      placeholder="选择日期时间">
							    </el-date-picker>
						</a-form-model-item>
						<a-form-model-item label="终止时间:" v-if="getElementShow(tableDataForm.valuetype,'D')">
							<el-date-picker
							      v-model="tableDataForm.totime"
							      :default-time="tableDataForm.totime"
							      type="year"
								  v-if="tableDataForm.pattern=='yyyy'"
							      value-format="yyyy"
								  placeholder="选择年">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.totime"
							      :default-time="tableDataForm.totime"
							      type="month"
								  v-if="tableDataForm.pattern=='yyyy-MM'"
							      value-format="yyyy-MM"
								  placeholder="选择月">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.totime"
							      :default-time="tableDataForm.totime"
							      type="date"
								  v-if="tableDataForm.pattern=='yyyy-MM-dd'"
							      value-format="yyyy-MM-dd"
								  placeholder="选择日期">
							</el-date-picker>
							<el-date-picker
							      v-model="tableDataForm.totime"
							      :default-time="tableDataForm.totime"
							      type="datetime"
								  v-if="tableDataForm.pattern=='yyyy-MM-dd HH:mm:ss'"
							      value-format="yyyy-MM-dd HH:mm:ss"
								  placeholder="选择日期时间">
							    </el-date-picker>				
						</a-form-model-item>
						<a-form-model-item style="margin-left:214px;" v-if="getElementShow(tableDataForm.valuetype,'D')">
							<a-checkbox :checked="isChecked(tableDataForm.nowasdefvalue)" name="nowasdefvalue" @change="onCheckBoxChang">是否使用系统时间作为默认值</a-checkbox>
						</a-form-model-item>
						<a-form-model-item label="存储位置:" v-if="getElementShow(tableDataForm.valuetype,'P')">
							<a-input />
						</a-form-model-item>
						<a-form-model-item label="存储位置:" v-if="getElementShow(tableDataForm.valuetype,'F')">
							<a-input />
						</a-form-model-item>
						<a-form-model-item label="目录文件所在虚拟目录:" v-if="getElementShow(tableDataForm.valuetype,'F')">
							<a-input />
						</a-form-model-item>
						<a-form-model-item label="转换单文件虚拟目录:" v-if="getElementShow(tableDataForm.valuetype,'F')">
							<a-input />
						</a-form-model-item>
						<a-form-model-item label="存储位置:" v-if="getElementShow(tableDataForm.valuetype,'H')">
							<a-tree-select
								allowClear
								:default-value="tableDataForm.vdir"
							    v-model="tableDataForm.vdir"
							    style="width: 100%"
							    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
							    :tree-data="treeData"
							    placeholder="Please select"
							    tree-default-expand-all
							  >
							  </a-tree-select>
						</a-form-model-item>
						<a-form-model-item label="存储位置:" v-if="getElementShow(tableDataForm.valuetype,'U')">
							<SelectTree :props="props" :options="optionData" :value="form.valueId" :clearable="isClearable" :accordion="isAccordion"
							 @getValue="getValue($event)" style="width: 100%" />
						</a-form-model-item>
						<a-form-model-item label="默认封面:" v-if="getElementShow(tableDataForm.valuetype,'E')">
							    <a-upload :file-list="fileList" :remove="handleImageRemove" :multiple="false"
								:before-upload="beforeImageUpload" @change="handleImageChange"
								action="https://www.mocky.io/v2/5cc8019d300000980a055e76">
							     <a-button style="margin-right: 10px;"> <a-icon type="upload" />上传</a-button>
								  
							    </a-upload>	
									<!-- <a-input ref="imageUrl" v-bind:value="imageName"></a-input> -->
								
						</a-form-model-item>
						<a-form-model-item label="存储位置
						:" v-if="getElementShow(tableDataForm.valuetype,'E')">
							<a-tree-select
								allowClear
								:default-value="tableDataForm.vdir"
							    v-model="tableDataForm.vdir"
							    style="width: 100%"
							    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
							    :tree-data="treeData"
							    placeholder="Please select"
							    tree-default-expand-all
							  >
							    <!-- <span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">
							      Child Node1 {{ value }}
							    </span> -->
							  </a-tree-select>
						</a-form-model-item>
						<a-form-model-item label="存储位置
						:" v-if="getElementShow(tableDataForm.valuetype,'S')">
							<a-tree-select
								allowClear
								:default-value="tableDataForm.vdir"
							    v-model="tableDataForm.vdir"
							    style="width: 100%"
							    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
							    :tree-data="treeData"
							    placeholder="Please select"
							    tree-default-expand-all
							  >
							    <!-- <span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">
							      Child Node1 {{ value }}
							    </span> -->
							  </a-tree-select>
						</a-form-model-item>
						<a-form-model-item label="水印路径:" v-if="getElementShow(tableDataForm.valuetype,'E')">
							<a-input v-model="tableDataForm.watermarkpath"/>
							
						</a-form-model-item>
						<a-form-model-item label="水印位置:"  v-if="getElementShow(tableDataForm.valuetype,'E')">
							<a-radio-group v-model="tableDataForm.watermarkpos" >
								<a-radio value="LT">
									左上角
								</a-radio>
								<a-radio value="CT">
									靠上居中
								</a-radio>
								<br />
								<a-radio value="RT">
									右上角
								</a-radio>
								<a-radio value="LC">
									靠左居中
								</a-radio>
								<br />
								<a-radio value="CC">
									居中
								</a-radio>
								<a-radio value="RC">
									靠右居中
								</a-radio>
								<br />
								<a-radio value="LB">
									左下角
								</a-radio>
								<a-radio value="CB">
									靠下居中
								</a-radio>
								<br />
								<a-radio value="RB">
									右下角
								</a-radio>
								<a-radio value="R">
									随机
								</a-radio>
							</a-radio-group>
						</a-form-model-item>
						<a-form-model-item label="根节点:" v-if="getElementShow(tableDataForm.valuetype,'A')">
							<a-tree-select
								allowClear
								:default-value="tableDataForm.rootruid"
							    v-model="tableDataForm.rootruid"
							    style="width: 100%"
							    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
							    :tree-data="treeData"
							    placeholder="Please select"
							    tree-default-expand-all
							  >
							    <!-- <span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">
							      Child Node1 {{ value }}
							    </span> -->
							  </a-tree-select>
						</a-form-model-item>
						<a-form-model-item label="默认节点:" v-if="getElementShow(tableDataForm.valuetype,'A')">
							<a-tree-select
								allowClear
							    v-model="treevalue"
							    style="width: 100%"
							    :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
							    :tree-data="treeData"
							    placeholder="Please select"
							    tree-default-expand-all
							  >
							    <!-- <span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">
							      Child Node1 {{ value }}
							    </span> -->
							  </a-tree-select>
						</a-form-model-item>
						<a-form-model-item label="长度:" v-if="getElementShow(tableDataForm.valuetype,'CM')">
							<a-input v-model="tableDataForm.len" />
						</a-form-model-item>
						<a-form-model-item label="默认值:" v-if="getElementShow(tableDataForm.valuetype,'CM')">
							<a-input v-model="tableDataForm.defvalue" />
						</a-form-model-item>
						<a-form-model-item label="字段属性:" v-if="getElementShow(tableDataForm.valuetype,'CMAEHUFDPS')">
							<a-checkbox :checked="isChecked(tableDataForm.mustflag)" name="mustflag" @change="onCheckBoxChang" v-if="getElementShow(tableDataForm.valuetype,'CMAEHUFDPS')">
								必备
							</a-checkbox>
							<a-checkbox :checked="isChecked(tableDataForm.repeatflag)" name="repeatflag" @change="onCheckBoxChang" v-if="getElementShow(tableDataForm.valuetype,'CAEHUFDPS')">
								可重复
							</a-checkbox>
							<a-checkbox :checked="isChecked(tableDataForm.sortflag)" name="sortflag" @change="onCheckBoxChang" v-if="getElementShow(tableDataForm.valuetype,'CEUDS')">
								可排序
							</a-checkbox>
						</a-form-model-item>
						<a-form-model-item label="参与检索方式:" v-if="getElementShow(tableDataForm.valuetype,'CM')">
							<a-checkbox :checked="isChecked(tableDataForm.fulltextsearch)" name="fulltextsearch" @change="onCheckBoxChang">
								分词搜索
							</a-checkbox>
							<a-checkbox :checked="isChecked(tableDataForm.exactmatch)" name="exactmatch" @change="onCheckBoxChang">
								精确搜索
							</a-checkbox>

						</a-form-model-item>
						<a-form-model-item label="检索生产方式:" v-if="getElementShow(tableDataForm.valuetype,'CM')">
							<a-radio-group v-model="tableDataForm.searchvalue" @change="onRadioChange">
								<a-radio :style="radioStyle" value="0">
									保持原值
								</a-radio>
								<a-radio :style="radioStyle" value="1">
									精简ISBN
								</a-radio>
								<a-radio :style="radioStyle" value="2">
									支持简繁体拼音同时检索
								</a-radio>
								<a-radio :style="radioStyle" value="3">
									后台代码
									<a-input v-if="value === 3" style="width: 40%;margin-left: 5px;" />
									<a-input v-if="value === 3" style="width: 40%;margin-left: 15px;" />
								</a-radio>
							</a-radio-group>
						</a-form-model-item>
						<a-form-model-item label="检验方式:" v-if="getElementShow(tableDataForm.valuetype,'C')">
							<a-radio-group v-model="tableDataForm.checktype">
								<a-radio value="0">
									不校验
								</a-radio>
								<a-radio value="1">
									电话号码
								</a-radio>
								<br />
								<a-radio value="2">
									手机号码
								</a-radio>
								<a-radio value="3">
									电子邮箱
								</a-radio>
								<br />
								<a-radio value="4">
									身份证号码
								</a-radio>
								<a-radio value="5">
									数字和字母
								</a-radio>
								<br />
								<a-radio value="6">
									ISBN
								</a-radio>
								<a-radio value="7">
									数字
								</a-radio>
								<br />
								<a-radio value="8">
									后台代码
									<a-input v-if="value1 === 8" style="width: 40%;margin-left: 5px;" />
									<a-input v-if="value1 === 8" style="width: 40%;margin-left: 15px;" />
								</a-radio>
							</a-radio-group>
						</a-form-model-item>
						<a-form-model-item label="应用到:">
							<a-row>
								<a-col :span="12">
									<a-checkbox :checked="isChecked(tableDataForm.listpage)" name="listpage" @change="onCheckBoxChang">
										列表页
									</a-checkbox>
								</a-col>
								<a-col :span="12">
									<a-checkbox :checked="isChecked(tableDataForm.detailspage)" name="detailspage" @change="onCheckBoxChang">
										详情信息页
									</a-checkbox>
								</a-col>
								<a-col :span="12">
									<a-checkbox :checked="isChecked(tableDataForm.editorpage)" name="editorpage" @change="onCheckBoxChang">
										资料录入页
									</a-checkbox>
								</a-col>
								<a-col :span="12">
									<a-checkbox :checked="isChecked(tableDataForm.bringvalue)" name="bringvalue" @change="onCheckBoxChang">
										回带录入
									</a-checkbox>
								</a-col>
							</a-row>
						</a-form-model-item>
						<a-form-model-item label="附件类型:" v-if="getElementShow(tableDataForm.valuetype,'F')">
							<a-input />
						</a-form-model-item>
						<a-form-model-item label="录入页组件:">
							<SelectTree :props="props" :options="optionData" :value="form.valueId" :clearable="isClearable" :accordion="isAccordion"
							 @getValue="getValue($event)" style="width: 100%" />
						</a-form-model-item>
						<a-form-model-item label="列表页模板选择:">
							<a-select placeholder="全部">
								<a-select-option value="1">
									列表页文本型
								</a-select-option>
								<a-select-option value="2">
									列表页文本型题名
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="详情页模板选择:">
							<a-select placeholder="全部">
								<a-select-option value="1">
									详情页文本型
								</a-select-option>
								<a-select-option value="2">
									详情页文本型题名
								</a-select-option>
								<a-select-option value="3">
									详情文本跳转
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="移动端列表页模板选择:">
							<a-select placeholder="全部">
								<a-select-option value="1">
									移动端列表页模板选择
								</a-select-option>
								<a-select-option value="2">
									移动端列表页模板选择题名
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="移动端详细页模板选择:">
							<a-select placeholder="全部">
								<a-select-option value="1">
									移动端详情页文本型
								</a-select-option>
								<a-select-option value="2">
									移动端详情页文本型题名
								</a-select-option>
							</a-select>
						</a-form-model-item>
						<a-form-model-item label="列表页定制模板:">
							<a-textarea placeholder="根据设置内容生成列表页面附件的html" />
						</a-form-model-item>
						<a-form-model-item label="详细页定制模板:">
							<a-textarea placeholder="根据设置内容生成详细页面附件的html" />
						</a-form-model-item>
						<a-form-model-item label="移动端列表页定制模板:">
							<a-textarea placeholder="根据设置内容生成移动端页面附件的html" />
						</a-form-model-item>
						<a-form-model-item label="移动端详细页定制模板:">
							<a-textarea placeholder="根据设置内容生成移动端详细页面附件的html" />
						</a-form-model-item>
					</a-form-model>
				</div>

			</a-modal>
		</div>
		</div>
		

	</div>
</template>
<script>
	const columns = [{
			title: '序号',
			dataIndex: 'key',
			width: 100,
			scopedSlots: {
				customRender: 'key'
			},
		},
		{
			title: '排序',
			dataIndex: 'order',
			width: 100,
			scopedSlots: {
				customRender: 'order'
			},
		}, {
			title: '编码',
			dataIndex: 'code',
			width: 100,
			scopedSlots: {
				customRender: 'code'
			},
		},
		{
			title: '名称',
			dataIndex: 'name',
			width: 100,
			scopedSlots: {
				customRender: 'name'
			},
		},
		{
			title: '类型',
			dataIndex: 'valuetype',
			width: 100,
			scopedSlots: {
				customRender: 'valuetype'
			},
		},
		{
			title: '操作',
			key: 'operation',
			scopedSlots: {
				customRender: 'operation'
			},
			width: 140,
		},
	];
// const treeData = [
//   {
//     title: 'Node1',
//     value: '0-0',
//     key: '0-0',
//     children: [
//       {
// 		title: 'Child Node1',
//         value: '0-0-1',
//         key: '0-0-1',
//         // scopedSlots: {
//         //   // custom title
//         //   title: 'title',
//         // },
//       },
//       {
//         title: 'Child Node2',
//         value: '0-0-2',
//         key: '0-0-2',
		
//       },
//     ],
//   },
//   {
//     title: 'Node2',
//     value: '0-1',
//     key: '0-1',
//   },
// ];
	import {
		dataTypeManageList,
		dataTypeManageSave,
		getClassNodeList
	} from '../../api/dataTypeManage.js';
	import SelectTree from "../../components/treeSelect";
	import {
		menulist
	} from "../../api/admin";
	export default {
		name: "dataTypeManage",
		components: {
			SelectTree,
		},
		computed: {
			/* 转树形数据 */
			optionData() {
				let cloneData = JSON.parse(JSON.stringify(this.manager_data)); // 对源数据深度克隆
				return cloneData;
			},
			treeData(){
				let td = this.originalTreeData;
				let tda = [];
				for(let i=0;i<td.length;i++){
					let obj = {
						title:"",
						value:"",
						key:""};
					obj.title = td[i].name;
					obj.value = td[i].ruid;
					obj.key = td[i].ruid;
					let arr = [];
					if(td[i].children!=undefined){//td[i].children
						for(let j=0;j<td[i].children.length;j++){
							let objChild = {
								title:"",
								value:"",
								key:""};
							objChild.title = td[i].children[j].name;
							objChild.value = td[i].children[j].ruid;
							objChild.key = td[i].children[j].ruid;
							arr.push(objChild);
						}
						obj.children = arr;
					}
					tda.push(obj);
				}
				
				return tda;
			},
		},
		beforeMount() {
			this.getMenuList();
			this.getDaDataTypeList(this.typeListParam);
			
		},
		watch:{
			initFormRuid:function(val){
				this.refreshDataTypeInfo(val)
			},
			 treevalue(value) {
			      // console.log(value);
			 },
		},
		data() {
			//let cacheData = this.tableData.map(item => ({ ...item }));
			return {
				entitytypeList:[],/* 实体类型列表 */
				feildnameList:[],/* 元数据值中存储的是entitytype表中fieldname字段的值 */
				metaDateData:"",
				dateFormatStyle:"",
				treevalue: undefined,
				originalTreeData:[],
				initFormRuid:"",
				editMetaTitle:"",
				imageName:"",//图片名字
				fileList:[],//上传图片路径
				manager_data: [], //树状图菜单
				props: {
					// 配置项（必选）
					value: "RUID",
					label: "name",
					children: "children",
				},
				defaultProps: {
					//树状图默认样式
					children: "children",
					label: "name",
				},
				isClearable: true, // 可清空（可选）
				isAccordion: true, // 可收起（可选）
				metaDataParams: {
					pageno: 0,
					type: "",
					codeflag: "1",
					filter: [{
						fieldname: "RUID",
						word: ""
					}],
					field: "",
				},
				order: 0,
				value: 1,
				value1: 1,
				radioStyle: {
					display: 'block',
					height: '30px',
					lineHeight: '30px',
				},
				editingKey: '',
				dataTypeForm: {
					key: '',
					dataTypeName: '',
					dataTypeCode: '',
					dataTypeTable: '',
				},
				//元数据列表设置页面form表单 
				tableDataForm: {
					RUID: "",
					name: "",
					type: "",
					code: "",
					valuetype: "",
					len: "",
					mustflag: "",
					repeatflag: "",
					defvalue: "",
					sortflag: "",
					editorpage: "",
					detailspage: "",
					listpage: "",
					managerpage: "",
					phoneeditorpage: "",
					phonedetailspage: "",
					phonelistpage: "",
					phonemanagerpage: "",
					order: "",
					ctrloptions: "",
					description: "",
					bringvalue: "",
					sysflag: "",
					readrule: "",
					writerule: "",
					writepermission: "",
					downpermission: "",
					downrule: "",
					onlinerule: "",
					onlinepermission: "",
					fulltextsearch: "",
					exactmatch: "",
					searchvalue: "",
					checktype: "",
					rootruid:"",//存放文分类类型元数据记录A
					nowasdefvalue:"",//是否系统时间作为默认值
					pattern:"",//显示模式
					fromtime:"",//起始时间
					totime:"",//结束时间
					// metadata6_image 存放图片附件元数据记录
					watermarkpath: '',/*存放水印文件的路径*/
					watermarkpos:'R',/*水印文件位置，*/
					vdir:'',/* 存储目录 */
					entitytype:'',/* 实体类型 */
					feildname:'',/* 字段名称 */
					
				},
				dataTypeVisible: false,
				dataTypeConfirmLoading: false,
				tableDataVisible: false,
				tableData: [],
				cacheData: [],
				deleteTableData: [],
				columns,
				count: 0,
				typeListParam: {
					"pageno": 0,
					"pagesize": 100,
					"type": "datamodel6",
					"codeflag": "1",
					"filter": [{
						"fieldname": "code",
						"relationop": ">",
						"word": "-1"
					}],
					"field": "RUID,name,tablename",
					"order": [{
						"fieldname": "name",
						"type": "A"
					}]
				},
				typeList: [],
				dataTypeInfoParams: {
					"pageno": 0,
					"type": "datamodel6",
					"codeflag": "1",
					"filter": [],
					"field": "RUID,code,tablename,entitytemp,name,noreadrightmessage,nodownrightmessage,phonedetailspage,editorpage,detailspage,listpage,phonelistpage,managerpage,phonemanagerpage,listhtml"
				},
				typeListTableParam: {
					"pageno": 0,
					"type": "metadata6",
					"codeflag": "1",
					"filter": [],
					"field": "RUID,name,type,code,valuetype,len,mustflag,repeatflag,sortflag,defvalue,editorpage,detailspage,listpage,managerpage,phoneeditorpage,phonedetailspage,phonelistpage,phonemanagerpage,order,ctrloptions,description,bringvalue,sysflag,readrule,writerule,writepermission,downrule,downpermission,onlinerule,onlinepermission"
				},
				form: {
					name: '',
					code: '',
					tablename: '',
					noreadrightmessage: '',
					nodownrightmessage: '',
					editorpage: '',
					detailspage: '',
					listhtml: '',
					RUID: '',
					phonedetailspage: '',
					phoneeditorpage: '',
					entitytemp: '',
					sysflag: '',
					listpage: '',
					phonelistpage: '',
					managerpage: '',
					phonemanagerpage: '',
				},
				saveOrUpdateParams: {
					"type": "datamodel6",
					"codeflag": "1",
					"object": {}
				},
				saveOrUpdateMetaParams: {
					"type": "datamodel6",
					"codeflag": "1",
					"object": {}
				},
				getClassCodeParams:{
						"type" : "column",
						"rootnode" : {
							"RUID" : "0",
							"exist" : "0",
							"show" : "0"
						},
						"deep" : 2,
						"field" : "RUID,name,parentid",
						"key" : {
							"RUID" : "ruid",
							"name" : "name",
							"children" : "children"
						},
						"filter":[],
						"order" : [ {
							"fieldname" : "name",
							"type" : "D"
						} ]
					},

			}
		},
		methods: {
			/* 实体元数据编辑界面-实体类型下拉框值改变 */
			handleEntityTypeClick(val){
				// console.log(val.tablename)
				// console.log(val)
				// 获取下拉子数据
				let params = this.metaDataParams;
				params.pageno = 0;
				params.type = "metadata6";
				params.field = "RUID,name,tablename";
				params.filter[0] = {
					"fieldname": "tablename",
					"word": val.tablename
				};
				this.tableDataForm.feildname = "";
				dataTypeManageList(params).then(res => {
					if (res.recordcount>0) {
						this.feildnameList = res.recordlist;
						// console.log(res.recordlist)
					}
				})
			},
			/* 实体类型下拉改变 */
			handleEntityTypeChange(e){
				//console.log(e)
			},
			getClassNode(){
				getClassNodeList(this.getClassCodeParams).then(res => {
					this.originalTreeData = res.nodes;
				})
			},
			handleMenuClick(val){
				
				this.refreshDataTypeInfo(val);
			},
			handleImageRemove(file) {
			      const index = this.fileList.indexOf(file);
			      const newFileList = this.fileList.slice();
			      newFileList.splice(index, 1);
			      this.fileList = newFileList;
			    },
			    beforeImageUpload(file) {
			      this.fileList = [file];
				  this.imageName = file.name;
				  console.log(file)
				  // this.$refs.imageUrl.value = file.name;
			      return true;
			    },
			 handleImageChange(info) {
				 if (info.file.status !== 'uploading') {
				         console.log(info.file, info.fileList);
				       }
				       if (info.file.status === 'done') {
				         this.$message.success(`${info.file.name} file uploaded successfully`);
				       } else if (info.file.status === 'error') {
				         this.$message.error(`${info.file.name} file upload failed.`);
				       }
			    },
			getValue(value) {
				//下拉树状图获取选中值
				// this.form.valueId = value
			},
			getMenuList() {
				menulist({
					type: "menunode7",
					rootnode: {
						RUID: "menunode",
						exist: "0",
						show: "1",
						propvalue: {
							name: "菜单根节点",
						},
					},
					deep: -1,
					field: "type,name,url,target,orderno,parentid,icontype,manageright,display,staticparam",
					key: {
						RUID: "RUID",
						name: "name",
						children: "children",
						display: "display",
					},
					filter: [],
					order: [{
						fieldname: "orderno",
						valuetype: "N",
						type: "A",
					}, ],
				}).then((res) => {
					//console.log(res);
					if (res.cxajaxrc == "0") {
						this.manager_data = res.nodes;
						this.sider_default_list.push(res.nodes[0].RUID); //设置左侧Sider默认选中打开
						this.check_sider_data = res.nodes[0];
						this.tableData = res.nodes[0].children;
						console.log(res.nodes);
					} else {
						this.$message.error("菜单列表:检索资料时发生错误");
					}
				});
			},
			getElementShow(type, val) {
				if (val.indexOf(type) != -1) {
					return true;
				} else {
					return false;
				}
			},
			onRadioChange(e) {
				console.log('radio checked', e.target);
				console.log(this.tableDataForm.searchvalue);
			},
			isChecked(val) {
				// console.log("切换："+(val == "1" ? true : false))
				if (val == "1") {
					return true;
				} else if (val == undefined) {
					//console.log(":::"+val)
					return false;
				} else {
					return false;

				}
				//return val == "1" ? true : false
			},
			onCheckBoxChang(e) {
				// console.log(`checked = ${e.target.checked}`);
				// console.log(e.target.name);
				// console.log(e.target.checked)
				// console.log("改变前："+this.tableDataForm[e.target.name]);
				// console.log(this.tableDataForm);
				if (e.target.checked) {
					this.tableDataForm[e.target.name] = '1';
				} else {
					this.tableDataForm[e.target.name] = '0';
				}
				// console.log("改变后："+this.tableDataForm[e.target.name]);
				// console.log(this.tableDataForm);
			},
			handleChange_1(value, key, column) {
				const newData = [...this.tableData];
				const target = newData.filter(item => key === item.key)[0];
				if (target) {
					target[column] = value;
					this.tableData = newData;
				}
			},
			edit_1(key) {
				const newData = [...this.tableData];
				const target = newData.filter(item => key === item.key)[0];
				this.editingKey = key;
				if (target) {
					target.editable = true;
					this.tableData = newData;
				}
			},
			save_1(key) {
				const newData = [...this.tableData];
				const newCacheData = [...this.cacheData];
				const target = newData.filter(item => key === item.key)[0];
				const targetCache = newCacheData.filter(item => key === item.key)[0];
				// console.log(newData)
				// console.log(target)
				// console.log(newCacheData)
				// console.log(targetCache)
				if (target && targetCache) {
					delete target.editable;
					this.tableData = newData;
					Object.assign(targetCache, target);
					this.cacheData = newCacheData;
				}
				this.editingKey = '';
			},
			cancel_1(key) {
				const newData = [...this.tableData];
				const target = newData.filter(item => key === item.key)[0];
				this.editingKey = '';
				if (target) {
					Object.assign(target, this.cacheData.filter(item => key === item.key)[0]);
					delete target.editable;
					this.tableData = newData;
				}
			},
			handleTableOk(val) {
				//console.log(this.$refs[val])
				let tableData = [...this.tableData];
				let tableDataItem = this.[val];
				let ruid = tableDataItem.RUID;
				let target = tableData.filter(item => item.RUID === ruid);
				Object.assign(target[0], tableDataItem)
				//target = tableDataItem;	
				this.tableData = tableData;
				this.$refs[val].resetFields();
				this.tableDataVisible = false;
			},
			onCellChange(key, dataIndex, value) {
				const tableData = [...this.tableData];
				const target = tableData.find(item => item.RUID === key);
				if (target) {
					target[dataIndex] = value;
					this.tableData = tableData;
				}
			},
			onDelete(key) {
				const tableData = [...this.tableData];
				this.tableData = tableData.filter(item => item.RUID !== key);
				deleteTableData.push(key)
			},
			handleAdd() {
				const {
					count,
					tableData,
					cacheData
				} = this;
				const order = this.tableData[this.tableData.length-1].order;
				const newData = {
					key: count + 1,
					code: "",
					name: "",
					valuetype: "",
					RUID: this.uuid(),
					order:order+1,
				};

				this.tableData = [...tableData, newData];
				this.cacheData = [...cacheData, newData];
				//console.log(this.tableData)
				this.count = count + 1;
				// edit_1(this.count)
			},
			resetForm(formName) {
				this.$refs[formName].resetFields();
			},
			showModal() {
				this.dataTypeVisible = true;
			},
			handleOk(formName) {
				//console.log(this.$refs[formName])
				//console.log(this.dataTypeForm)

				this.form.name = this.dataTypeForm.dataTypeName;
				this.form.code = this.dataTypeForm.dataTypeCode;
				this.form.tablename = this.dataTypeForm.dataTypeTable;
				this.tableData = [];
				this.dataTypeVisible = false;
				this.dataTypeConfirmLoading = false;
				this.resetForm(formName);

			},
			handleCancel(formName) {
				//console.log(this.forms)
				this.forms.resetFields();
				//console.log(this.forms.resetFields())

			},
			getDaDataTypeList(params) {
				dataTypeManageList(params).then(res => {
					// console.log(res.recordlist[0].RUID)
					this.initFormRuid = res.recordlist[0].RUID;
					// console.log(this.initFormRuid)
					this.typeList = res.recordlist;
					
					//console.log(this.typeList[0])
				})
			},
			refreshDataTypeInfo(ruid) {
				let param = [{
					"fieldname": "RUID",
					"word": ruid
				}];
				this.dataTypeInfoParams.filter = param;
				dataTypeManageList(this.dataTypeInfoParams).then(res => {
					this.form = res.recordlist[0];
					let tableParam = [{
						"fieldname": "dmcode",
						"word": res.recordlist[0].code
					}];
					this.typeListTableParam.filter = tableParam;
					dataTypeManageList(this.typeListTableParam).then(res => {
						this.cacheData = [];
						this.tableData = [];
						this.deleteTableData = [];
						this.order = 0;
						//console.log(JSON.stringify(res.recordlist))
						if (res.recordcount != 0) {
							for (var i = 0; i < res.recordlist.length; i++) {
								res.recordlist[i].key = i + 1;
								// res.recordlist[i].uuidA = res.recordlist[i].RUID;
							}
							this.tableData = res.recordlist;
							this.order = this.tableData[this.tableData.length - 1].order;
							//console.log(res.recordlist.length)
							this.cacheData = this.tableData.map(item => ({ ...item
							}));
							this.count = this.tableData.length;
						} else {
							//console.log(res)
							this.order = 0;
							this.count = 0;
						}


					});
				});
			},
			onSubmit() {
				//console.log('表单保存按钮!', this.form);
				//console.log(this.form);
				this.saveOrUpdateParams.type = "datamodel6";
				this.saveOrUpdateParams.object = this.form;
				dataTypeManageSave(this.saveOrUpdateParams).then(res => {
					//console.log(res)
					//保存元数据表
					console.log(this.tableData)
					if (this.tableData.length > 0) {
						for (let i = 0; i < this.tableData.length; i++) {
							this.saveOrUpdateParams.type = "metadata6";
							delete this.tableData[i].key;
							this.tableData[i].dmcode = this.form.code;
							this.saveOrUpdateParams.object = this.tableData[i];
							if ((this.tableData[i].RUID).indexOf("-") != -1) {
								delete this.tableData[i].RUID;
							}
							// console.log(JSON.stringify(this.saveOrUpdateParams))
							dataTypeManageSave(this.saveOrUpdateParams).then(res => {
								// console.log(JSON.stringify(this.saveOrUpdateParams))
								let temRuid = res.returnvalue.RUID;
								this.tableData[i].RUID = temRuid;
								if (this.tableData[i].updataFlag == undefined) {
									//console.log("undefinded.....")
								} else if (this.tableData[i].updataFlag == false) {
									//console.log("false")
								} else if (this.tableData[i].valuetype == "C" || this.tableData[i].valuetype == "M") {
									this.saveOrUpdateMetaParams.type = "metadata6_text";
									this.saveOrUpdateMetaParams.object = {
										exactmatch: this.tableData[i].exactmatch,
										fulltextsearch: this.tableData[i].fulltextsearch,
										searchvalue: this.tableData[i].searchvalue,
										checktype: this.tableData[i].checktype,
										RUID: this.tableData[i].RUID,
										sortflag: this.tableData[i].sortflag,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
										len:this.tableData[i].len,
									};
									// console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))

									})
								} else if(this.tableData[i].valuetype == "A" ){
									this.saveOrUpdateMetaParams.type = "metadata6_category";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
										rootruid: this.tableData[i].rootruid,
									};
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								} else if(this.tableData[i].valuetype == "D" ){
									this.saveOrUpdateMetaParams.type = "metadata6_date";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
										sortflag: this.tableData[i].sortflag,
										rootruid: this.tableData[i].rootruid,
										nowasdefvalue: this.tableData[i].nowasdefvalue,
										pattern: this.tableData[i].pattern,
										fromtime: this.tableData[i].fromtime,
										totime: this.tableData[i].totime,
									};
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								} else if(this.tableData[i].valuetype == "E" ){
									this.saveOrUpdateMetaParams.type = "metadata6_image";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										watermarkpath: this.tableData[i].watermarkpath,
										watermarkpos: this.tableData[i].watermarkpos,
										vdir: this.tableData[i].vdir,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
										sortflag: this.tableData[i].sortflag,
									};
									
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								} else if(this.tableData[i].valuetype == "H" || this.tableData[i].valuetype == "P"){
									this.saveOrUpdateMetaParams.type = "metadata6_video";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										vdir: this.tableData[i].vdir,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
									};
									
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								} else if(this.tableData[i].valuetype == "S"){
									this.saveOrUpdateMetaParams.type = "metadata6_iso";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										vdir: this.tableData[i].vdir,
										mustflag: this.tableData[i].mustflag,
										repeatflag: this.tableData[i].repeatflag,
										sortflag: this.tableData[i].sortflag,
									};
									
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								} else if(this.tableData[i].valuetype == "N"){
									this.saveOrUpdateMetaParams.type = "metadata6_entity";
									this.saveOrUpdateMetaParams.object = {
										RUID: this.tableData[i].RUID,
										entitytype: this.tableData[i].entitytype,
										feildname: this.tableData[i].feildname,
									};
									
									console.log(JSON.stringify(this.saveOrUpdateMetaParams))
									dataTypeManageSave(this.saveOrUpdateMetaParams).then(res => {
										//console.log(JSON.stringify(this.saveOrUpdateParams))
									
									})
								}


							})
						}
					}
					 this.getDaDataTypeList(this.typeListParam);
					 this.refreshDataTypeInfo(this.form.RUID);
					// this.$message.info('保存成功！');
				});
			},
			onDataSet() {
				console.log('资料组按钮!', this.form);
			},
			// onDelete() {
			// 	console.log('表单删除按钮!', this.form);
			// },
			onInitDataStructure() {
				console.log('初始化数据结构!', this.form);
			},
			ondataBackup() {
				console.log('数据备份按钮!', this.form);
			},
			onRecovery() {
				console.log('数据恢复按钮!', this.form);
			},
			onTableSet(record) {
				this.tableDataVisible = true;
				//this.tableDataForm = record;
				Object.assign(this.tableDataForm, record);
				this.tableDataForm.updataFlag = true;
				let params = this.metaDataParams;
				if (record.valuetype == 'C') {
					this.editMetaTitle = "文本型元数据编辑"
					params.type = "metadata6_text";
					params.field = "exactmatch,fulltextsearch,searchvalue,checktype";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						if (metaObj.exactmatch != undefined) {
							this.tableDataForm.exactmatch = metaObj.exactmatch;
						}
						if (metaObj.fulltextsearch != undefined) {
							this.tableDataForm.fulltextsearch = metaObj.fulltextsearch;
						}
						if (metaObj.searchvalue != undefined) {
							this.tableDataForm.searchvalue = metaObj.searchvalue;
						}
						if (metaObj.checktype != undefined) {
							this.tableDataForm.checktype = metaObj.checktype;
						}
						//console.log(this.tableDataForm)
					})
				}else if(record.valuetype == 'M'){
					this.editMetaTitle = "多行文本型元数据编辑";
				}else if(record.valuetype == 'A'){
					this.editMetaTitle = "分类节点元数据编辑";
					this.getClassNode();
					params.type = "metadata6_category";
					params.field = "rootruid";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						if (metaObj.rootruid != undefined) {
							this.tableDataForm.rootruid = metaObj.rootruid;
						}
					})
				}else if(record.valuetype == 'E'){
					this.editMetaTitle = "图像型元数据编辑";
					this.getClassNode();
					params.type = "metadata6_image";
					params.field = "watermarkpath,watermarkpos,vdir";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						console.log(JSON.stringify(res.recordlist))
						if (metaObj.watermarkpath != undefined) {
							this.tableDataForm.watermarkpath = metaObj.watermarkpath;
						}
						if (metaObj.watermarkpos != undefined) {
							this.tableDataForm.watermarkpos = metaObj.watermarkpos;
						}
						if (metaObj.vdir != undefined) {
							this.tableDataForm.vdir = metaObj.vdir;
						}
					})
				}else if(record.valuetype == 'H'){
					this.editMetaTitle = "视频文件型元数据编辑";
					this.getClassNode();
					params.type = "metadata6_video";
					params.field = "vdir";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						console.log(JSON.stringify(res.recordlist))
						if (metaObj.vdir != undefined) {
							this.tableDataForm.vdir = metaObj.vdir;
						}
					})
				}else if(record.valuetype == 'E'){
					this.editMetaTitle = "分类节点元数据编辑";
				}else if(record.valuetype == 'U'){
					this.editMetaTitle = "文件夹元数据编辑";
				}else if(record.valuetype == 'F'){
					this.editMetaTitle = "文件附件型元数据编辑";
				}else if(record.valuetype == 'D'){
					this.editMetaTitle = "日期类元数据编辑";
					params.type = "metadata6_date";
					params.field = "nowasdefvalue,pattern,fromtime,totime";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						if (metaObj.nowasdefvalue != undefined) {
							this.tableDataForm.nowasdefvalue = metaObj.nowasdefvalue;
						}
						if (metaObj.pattern != undefined) {
							this.tableDataForm.pattern = metaObj.pattern;
						}
						if (metaObj.fromtime != undefined) {
							this.tableDataForm.fromtime = metaObj.fromtime;
						}
						if (metaObj.totime != undefined) {
							this.tableDataForm.totime = metaObj.totime;
						}
					})
				}else if(record.valuetype == 'P'){
					this.editMetaTitle = "音频文件附件型元数据编辑";
					this.editMetaTitle = "视频文件型元数据编辑";
					this.getClassNode();
					params.type = "metadata6_video";
					params.field = "vdir";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						console.log(JSON.stringify(res.recordlist))
						if (metaObj.vdir != undefined) {
							this.tableDataForm.vdir = metaObj.vdir;
						}
					})
				}else if(record.valuetype == 'S'){
					this.editMetaTitle = "光盘文件附件型元数据编辑";
					this.getClassNode();
					params.type = "metadata6_iso";
					params.field = "vdir";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						// console.log(JSON.stringify(res.recordlist))
						if (metaObj.vdir != undefined) {
							this.tableDataForm.vdir = metaObj.vdir;
						}
					})
				} else if(record.valuetype == 'N'){
					this.editMetaTitle = "实体类型元数据编辑";
					// this.getClassNode();
					//获取实体类型下拉列表
					params.pageno = 0;
					params.type = "datamodel6";
					params.field = "RUID,name,tablename";
					params.filter[0] = {
						"fieldname": "code",
						"word": "-1"
					};
					dataTypeManageList(params).then(res => {
						if (res.recordcount>0) {
							this.entitytypeList = res.recordlist;
							//console.log(this.entitytypeList	)
						}
					})
					//获取实体类型元数据
					params.type = "metadata6_entity";
					params.field = "entitytype,feildname";
					params.filter[0] = {
						"fieldname": "RUID",
						"word": record.RUID
					};
					dataTypeManageList(params).then(res => {
						const metaObj = res.recordlist[0];
						// console.log(JSON.stringify(res.recordlist))
						if (metaObj.entitytype != undefined) {
							this.tableDataForm.entitytype = metaObj.entitytype;
						}
						if (metaObj.feildname != undefined) {
							this.tableDataForm.feildname = metaObj.feildname;
						}
					})
				}
				else{
					this.editMetaTitle = "元数据编辑";
				}
			},
			onTableDelete(record, text) {
				console.log("删除:" + JSON.stringify(record))
			},
			onTableInsert(record) {
				console.log("插入:" + JSON.stringify(record))
			},
			onTableMoveUp(record) {
				//console.log("上移前:" + JSON.stringify(record));
				const tableData = [...this.tableData];
				const key = record.key;
				if (key > 1) {
					let moveTarget = tableData.find(item => item.key === key);
					let downTarget = tableData.find(item => item.key === (key - 1));
					moveTarget.key = downTarget.key;
					downTarget.key = key;
					let order = moveTarget.order;
					moveTarget.order = downTarget.order;
					downTarget, order = moveTarget.order;
					tableData[key - 1] = downTarget;
					tableData[key - 2] = moveTarget
					this.tableData = tableData;
				}

			},
			onPageSelect(type, id) {
				console.log(type + ":" + id + ":点击选择按钮")
			},
			onPageCopy(type, id) {
				console.log(type + ":" + id + ":点击复用按钮")
			},
			onPageCreat(type, id) {
				console.log(type + ":" + id + ":点击新建按钮")
			},
			onPageAdd(type, id) {
				console.log(type + ":" + id + ":点击增量按钮")
			},
			onPageSet(type, id) {
				console.log(type + ":" + id + ":点击设置按钮")
			},
			addDataType() {
				console.log('新增资料类型按钮')
				this.dataTypeVisible = true;

			},
			copyDataType() {
				console.log('套用资料类型按钮')
			},
			copyDataType() {
				console.log('套用资料类型按钮')
			},
			copyDataType() {
				console.log('套用资料类型按钮')
			},
			copyDataType() {
				console.log('套用资料类型按钮')
			},
			uuid() {
				var s = [];
				var hexDigits = "0123456789abcdef";
				for (var i = 0; i < 36; i++) {
					s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
				}
				s[14] = "4";
				s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);
				s[8] = s[13] = s[18] = s[23] = "-";

				this.uuidA = s.join("");
				//console.log(s.join(""), 's.join("")');
				return this.uuidA;
			},
		}
	}
</script>

<style scoped>
	.a-input {
		border: 1px solid #378888 !important;
	}
/* 
	.button-color-sunset {

		&:hover,
		&:focus {
			background-color: #000000;
			border-color: #000000;
		}

		&:active,
		&.active {
			background-color: #000000;
			border-color: #000000;
		}
	} */

	.editable-cell {
		position: relative;
	}

	.editable-cell-input-wrapper,
	.editable-cell-text-wrapper {
		padding-right: 24px;
	}

	.editable-cell-text-wrapper {
		padding: 5px 24px 5px 5px;
	}

	.editable-cell-icon,
	.editable-cell-icon-check {
		position: absolute;
		right: 0;
		width: 20px;
		cursor: pointer;
	}

	.editable-cell-icon {
		line-height: 18px;
		display: none;
	}

	.editable-cell-icon-check {
		line-height: 28px;
	}

	.editable-cell:hover .editable-cell-icon {
		display: inline-block;
	}

	.editable-cell-icon:hover,
	.editable-cell-icon-check:hover {
		color: #108ee9;
	}

	.editable-add-btn {
		margin-bottom: 8px;
	}
	.main_margin {
  background-color: #fff;
  margin: 10px;
  height: 100%;
}
</style>
